/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.mzk.oai.metadataRepository.cli;

import cz.mzk.oai.metadataRepository.cli.alephHarvest.ExportHarvester;
import cz.mzk.oai.metadataRepository.cli.alephHarvest.Harvester;
import cz.mzk.oai.metadataRepository.metadata.DateStamp;
import cz.mzk.oai.metadataRepository.repository.AlephBase;
import cz.mzk.oai.metadataRepository.repository.Repository;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Martin Řehánek (rehan at mzk.cz)
 */
public class HarvestMarcFromUntilAction extends Action{

    private final Harvester harvester;
    private final DateStamp from;
    private final DateStamp until;
    private final String alephBase;


    public HarvestMarcFromUntilAction(Repository repository, Properties properties, String from, String until, String alephBase) {
        super(repository);
        this.from = DateStamp.parse(from);
        this.until = DateStamp.parse(until);
        this.alephBase = alephBase;
        harvester = new ExportHarvester(repository, properties);
    }

    public void run() throws IOException {
        harvester.harvestBetween(AlephBase.valueOf(alephBase), from, until);
    }

}
